package com.example.xunai.dto.request.conversation;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class CreateConversationRequest {
    @NotBlank(message = "对话标题不能为空")
    private String title;

    @NotBlank(message = "模型类型不能为空")
    private String model;

    private String sessionId;

    @NotNull(message = "用户ID不能为空")
    private Long userId;

    public static CreateConversationRequest of(String title, String model, Long userId) {
        return new CreateConversationRequest(title, model, null, userId);
    }

    public static CreateConversationRequest of(String title, String model, String sessionId, Long userId) {
        return new CreateConversationRequest(title, model, sessionId, userId);
    }

    public boolean isValid() {
        return title != null && !title.trim().isEmpty()
                && model != null && !model.trim().isEmpty()
                && userId != null;
    }
}